#ifndef _AI_COMPONENT_H_
#define _AI_COMPONENT_H_

#include "IComponent.h"
#include "..\Math\Vector2.h"

class FlyingAIComponent : public IComponent
{
public:
	FlyingAIComponent(const std::string& p_target);
	virtual ~FlyingAIComponent(void);

	virtual const std::string getType() { return "FlyingAIComponent"; }
	virtual const std::string getFamilyType() { return "FlyingAIComponent"; }

	virtual void init();
	virtual void update(const GameTime& p_gameTime);

protected:
	enum FlyingAIState
	{
		AI_FLYING_IDLE = 0,
		AI_FLYING_ATTACKING,
		AI_FLYING_RETURNING,
		AI_FLYING_SIZE
	};

	typedef void (FlyingAIComponent::*AIStateFuncPtr)();

	void idle();
	void attacking();
	void returning();

	std::string m_target;
	float m_minDistance;
	float m_distance;
	float m_idleYPos;
	float m_distanceLeft;
	int m_aiState;
	AIStateFuncPtr m_aiFuncPtr[AI_FLYING_SIZE];
	vn::Vector2 m_attackPosition;
	vn::Vector2 m_startPosition;
	vn::Vector2 m_attackDirection;
};

#endif // _AI_COMPONENT_H_